﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Carbon.Web.Forms
{
    public class BindingException : InvalidOperationException
    {
        public override string Message
        {
            get
            {
                String message = string.Format("Error on path '{0}'. Root object type '{1}'.", Path, Root.GetType());

                return message;
            }
        }

        private String m_Path = default(String);
        public String Path
        {
            get
            {
                return m_Path;
            }
        }


        private Object m_Root = default(Object);
        public Object Root
        {
            get
            {
                return m_Root;
            }
        }

        public BindingException(String path, Object root, Exception innerException)
            : base(string.Empty, innerException)
        {
            if (root == null) throw new NullReferenceException("root");

            m_Root = root;
            m_Path = path;

        }
    }
}
